fix(desktop): enable native Windows toast notifications - #6689
fix(desktop): enable native Windows toast notifications#6689fatima-n09 wants to merge 2 commits into
Conversation
The show_native_notification command only handled Linux and macOS. On Windows it returned an error, forcing the frontend to fall through to window.Notification (WebKit API). WebView2's Notification.permission reports 'denied' even when the WinRT toast API is available, so the app never appeared in Windows Settings > System > Notifications and the settings toggle was stuck showing 'Desktop notifications are blocked.' - Add tauri-winrt-notification as a Windows-specific dependency - Add a windows module in notifications.rs that posts WinRT toasts using the app's Tauri identifier as AppUserModelID (this is what registers the app with Windows notification settings) - Handle click actions through WinRT Activated handler, forwarding to the same native-notification-activated event that Linux uses - Add isWindowsPlatform() helper to platform.ts - Skip WebView2 Notification.permission check on Windows in getDesktopNotificationPermissionState() — use the Tauri plugin's isPermissionGranted() which queries native WinRT status - Route Windows through the native show_native_notification path in sendDesktopNotification() - Skip the Tauri plugin's onAction listener on Windows (click actions come through the native WinRT event instead) Fixes block#6377 Signed-off-by: Fatima Nur <fatimanur424@example.com>
cb080fd to
cbc66de
Compare
Chessing234
left a comment
There was a problem hiding this comment.
this overlaps #6678 — both add a windows toast path (winrt vs the tauri plugin). please pick one; if this is the native path, drop the plugin send on windows so we don't double-fire.
Add explicit comment in sendDesktopNotification() stating that the Tauri notification plugin's sendNotification() must not be used on Windows — the native WinRT path handles delivery and click actions exclusively. This clarifies the design intent for reviewers and prevents future contributors from adding a duplicate Tauri plugin path on Windows. Signed-off-by: Fatima Nur <fatimanur424@example.com>
|
@Chessing234 Thanks for the review! You're right about the overlap with #6678. |
|
I should have also said: This is awesome, love having notifications ! The toaster click is not a problem for me, was just pointing it out. |
|
@jhedlund Thanks for testing on Windows 11! Glad the notifications are working for you. And thanks for the screenshot noted! |
Thanks for the heads-up! Nice that close-to-tray works with this. I’ll take a look at #6893. |

Description:
Root cause
Fix
Files:
Tests added:
Fixes #6377